home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
201-225
/
210
/
calc
/
calc3.0.doc
< prev
next >
Wrap
Text File
|
1995-03-13
|
9KB
|
253 lines
*** NEW FEATURES OF CALC3.0 ***
1. Fixes a bug that prevents calc2.0 from loading into machines without
FAST memory. (bug reported by Lewis B. Wetzel.)
2. Iconification (Iconification routine by Leo L. Schwab).
3. Smaller code (about 15K smaller).
4. More variables (26 instead of 4).
5. Different syntax for assignment of variables, eg use "X = 2.4" instead
of "> X". Also, use the "EXE" gadget instead of the "=" gadget to end
and evaluate the expression.
6. Use pull down menus for selecting options instead of gadgets.
7. New functions for the programmer calculator.
8. Integers can now be 8, 16, or 32 bits.
*** IMPORTANT ***
This calculator is case sensitive. All functions must be in lower case,
and all numbers must be in uppser case, including the number PI and E.
This is a scientific/programmer/plotter calculator that I wrote in Manx C.
It operates differently from other calculators in that you can see the
expression you are evaluating on the screen. For example, to evalute 2
plus 21, you can type, from the keyboard,
"2 + 21",
and then <RETURN>, and while you are typing, the characters you typed are
echoed to the little window on the calculator. After you have pressed
<RETURN>, the result of "2 + 21" appears on the calculator window beneath
the line you just typed.
You can also enter the above expression by clicking on the gadgets in the
calculator window, except that you click on the "EXE" gadget to get the
result instead of pressing the <RETURN> key.
If you made a typo while entering your expression, you can use the
BACKSPACE, DELETE, and the forward and backward arrow keys to correct it,
or the "BS", "<--" and "-->" gadgets. The calculator will scroll part of
the line you're entering off window if your expression gets too long. The
maximum number of characters a line can contain is 255. And finally, you
can recall the last expression you entered by pressing the up arrow, or
clear the expression you're entering by pressing the down arrow, or click
on the "RCL" and "CLR" gadgets.
Other useful functions of the calculator include a 26 variable storage
memory. The variables are A, B, C,...Z. To store a number, you type from
the keyboard or click on the gadgets:
variable = expression,
For example, if you type
A = B + 1,
and B equals 1, then A equals 2.
Note: The variable Z is always equal to the result of the last
expression. So if you type
"4 + -2",
and <RETURN>, Z becomes 2. If you then type
"Z + 1",
and <RETURN>, you get 3 (and Z becomes 3).
To see what is stored in W, type
"W",
and then <RETURN>.
NOTE: In scientific mode, you only have 25 variables, not 26, because E is
a constant and is defined to be 2.718281828.
To change from one mode to others, use the "type" menu. The title bar on
the window will tell you what mode you in. For example, if you are in the
scientific mode, the title bar will display
Scientific Rad
The "Rad" means that angles are displayed in radian mode. To toggle
between radian and degree mode, use the "angle" menu.
If you are in the programmer mode, the title bar will display
Programmer Dec S32
The Dec indicates that the calculator displays result in decimal. To
change to hexidecimal or octal base, use the "int base" menu. The S
indicates that you are using signed integers. To change it, use the "int
sign" menu. The "16" indicates that you are using 32 bit integers. To
change to 8 or 16 bit integers, use "int size" menu.
And finally, in the Plotter mode, the title bar will display
Plotter
Also, the title bar will display "Syntax Error" if you've enter a equation
with syntax errors. And the title bar will display the x and y coordinate
of the graph if you click on the graph or the arrows. You can make the
title bar display x coordinate alone, y coordinate alone, or both x and y
coordinates by making the appropriate choice in the "display" menu.
NOTE: Always press the RETURN key after you have finished entering the
equation, the xmax, xmin, ymax, or ymin value before clicking on another
gadget. Otherwise, the program will not know that you have entered a new
value or equation and take the appropriate action.
Here's a list of the math functions supported by the scientific calculator
+ plus
- minus or unary minus eg 12 - 23 = -11
or 12 +-23 = -11
* multiply
/ divide
sin sine
cos cosine
tan tangent
ln natural log
log log of base 10
sinh hyperbolic sine
cosh hyperbolic cosine
tanh hyperbolic tangent
^ power eg 2 ^ 3 = 8
sqrt square root
asin arc sine
acos arc cosine
atan arc tanget
exp exponential function
e 10 to the power of eg 2e2 = 200
csc cosecant
sec secant
cot cotangent
abs absolute value of
! factorial eg 3! = 6
In addition, PI equals 3.14159 and E equals 2.71828
Examples of expressions (spaces need not be typed)
"1 + 2.34" = 3.34
"2 + -4" = -2.0
"6 - 12 / 4" = 3.0
"1.2e-1" = .112
"(6-12)/4" = -1.5
"sin(0)" = 0.0
"cos(PI)" = -1.0
"2!+3" = 5.0
"ln(E^2)" = 2.0
"log(1e6)" = 6.0
"W" = whatever is stored in the variable W
"W + 4" = the value of variable W plus 4
"X = W + 4" = X equals the result of W plus 4
Here's a list of the functions supported by the programmer calculator
All calculations can done on 8, 16, or 32 bit integers, sign or unsigned.
+ plus
- minus or unary minus eg 12 - 23 = -11
or 12 +-23 = -11
* multiply
/ divide
mod mod eg A mod 3
>> shift right eg 3 >> B
<< shift left
asl arithmetic shift left eg $FF asl 3
asr arithmetic shift right
lsl logical shift left eg \352 lsl C
lsr logical shift right
rol rotate left eg %10010 rol 7
ror rotate right
not one's complement eg not 3
and logical and eg E and F
nand not and
xor logical xor
nxor not xor
or logical or
nor not or
Precedents of the operators are: (follows the C precedent for operators)
Highest
( )
not abs - (unary minus)
* / mod
+ -
<< >> asl asr lsl lsr rol ror
and nand
xor nxor
or nor
=
Lowest
Operators on the same line have the same precedent.
Also, you can input numbers in hex, octal, decimal, binary or ascii.
Hex numbers start with a dollar sign $. eg $0FAC
Octal numbers start with a backslash \. eg \234
Binary numbers start with a percentage sign %. eg %101010
ASCII numbers start and end with a single quote '. eg 'a' or '&'
NOTE:
As in C language,
>> is a arithmetic shift left if using signed integer.
>> is a logical shift left if using unsigned integer.
The rest of the calculator is pretty much self explanatory, so explore and
have fun.
Finally, I like to thank Leo L. Schwab for putting his iconification
routine in public domain. I encourage people to use it. It's great. Here
is the copyright notice at the beginning of his iconify routine.
/* :ts=8 bk=0
*
* iconify.c: You asked for it, you got it.
*
* Copyright 1987 by Leo L. Schwab.
* Permission is hereby granted for use in any and all programs, both
* Public Domain and commercial in nature, provided this Copyright notice
* is left intact. Purveyors of programs, at their option, may wish observe
* the following conditions (in the spirit of hackerdom):
* 1: You send me a free, registered copy of the program that uses the
* iconify feature,
* 2: If you're feeling really nice, a mention in the program's
* documentation of my name would be neat.
*
* 8712.10 (415) 456-3960
*/
/*
That's it. If you have any questions, comments, bug reports, sent it to
Jimmy Yang
1115 Lura,
Pasadena, California, 91106